﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using NSsh.Common.Types;
using NUnit.Framework.SyntaxHelpers;
using System.IO;
using System.Collections;

namespace NSsh.Common.Tests.Types
{
    [TestFixture]
    public class CompressionAlgorithmHelperFixture
    {
        [Test]
        public void ShouldParseCorrectly()
        {
            Assert.That(CompressionAlgorithmHelper.Parse(CompressionAlgorithmHelper.None), Is.EqualTo(CompressionAlgorithm.None));
            Assert.That(CompressionAlgorithmHelper.Parse(CompressionAlgorithmHelper.Zlib), Is.EqualTo(CompressionAlgorithm.Zlib));
        }

        [Test]
        public void ShouldToStringCorrectly()
        {
            Assert.That(CompressionAlgorithmHelper.ToString(CompressionAlgorithm.None), Is.EqualTo(CompressionAlgorithmHelper.None));
            Assert.That(CompressionAlgorithmHelper.ToString(CompressionAlgorithm.Zlib), Is.EqualTo(CompressionAlgorithmHelper.Zlib));
        }

        [Test]
        public void ShouldFailForInvalidAlgorithm()
        {
            Assert.That(new MethodInvoker(delegate
            {
                CompressionAlgorithmHelper.ToString((CompressionAlgorithm)(-1));

            }), Throws.Exception<ArgumentException>());

            Assert.That(new MethodInvoker(delegate
            {
                CompressionAlgorithmHelper.Parse("bogus");

            }), Throws.Exception<ArgumentException>());
        }
    }
}
